package org.jeecg.modules.simulator.factory;

import lombok.Getter;
import lombok.Setter;
import org.jeecg.modules.simulator.jsonot.*;
import org.jeecg.modules.simulator.model.SceneParam;
import org.jeecg.modules.simulator.model.SimulatorParam;
import org.jeecg.modules.simulator.model.line.station.station.Station;
import org.jeecg.modules.simulator.model.line.station.station.TransferStation;
import org.jeecg.modules.simulator.model.person.Person;
import org.jeecg.modules.simulator.model.train.timeplan.TrainPlanTable;
import org.jeecg.modules.simulator.service.HistoryBizPersonLoaderService;
import org.jeecg.modules.simulator.service.HistoryBizTrainLoaderService;
import org.jeecg.modules.simulator.service.T80RouteHisService;
import org.jeecg.modules.simulator.util.UnitCache;
import org.jeecg.modules.simulator.vo.VirtualTrainSchedularQueryCondition;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @program:
 * @description:加载一段时间的业务数据
 * @author: renzhg
 * @create: 2024-10-09 10:11
 **/
@Service
public class LoadTimePeriodHistory implements LoadHistoryData {
//    //    @Setter
////    SimulatorParam simulatorParam;
//    @Setter
//    HistoryBizTrainLoaderService historyBizTrainLoaderService;//历史列车时刻表
//
//    @Setter
//    HistoryBizPersonLoaderService historyBizPersonLoaderService;//历史人员数据
//
//    @Getter
//    Map<String, List<TrainPlanTable>> trainPlanTableMapByLine = new HashMap<>();
//    //路径表
//    @Getter
//   @Setter
//    Map<String, List<RouteStation>> t80RouteHisMap = new HashMap<>();
//
//    //    乘车人员分布,key:定义odID
//
//    @Getter
//    @Setter
//    Map<String, TrainPsgDistributionApiInfo> trainPsgDistributionApiInfoMap = new HashMap<>();
//    @Getter
//    @Setter
//    Map<String, Map<String, NumPeopEnStationApiInfo>> numPeopEnStationApiInfoMap = new HashMap<>();
//    //    车站人员分布, key:stationId,这个只是路径信息，不是人员信息
//    @Getter
//    @Setter
//    Map<String, List<PsgStationDistributionInfo>> psgStationDistributionInfoMap = new HashMap<>();
//    //乘车人员分布
//    @Getter
//    Map<String, List<Person>> personTrainMap = new HashMap<>();
//
//    //各站人员OD分配概率,key:定义odID
//    @Getter
//    @Setter
//    Map<String, List<ODProbabilityApiInfo>> odProbabilityApiInfoMap = new HashMap<>();
//
//    @Getter
//    //key:列车id，第二个key：阶段路线起始站（可以是换乘站或者开始站）-下车车站名
//    Map<String, Map<String, List<Person>>> personTrainMapByLine = new HashMap<>();
//
//
//    public void loadEntryStationNum(String sceneCode) {
//        SceneParam sceneparam = UnitCache.sceneParamMap.get(sceneCode);
//        String personDate=sceneparam.getSceneTimePeriodParam().getHistoryTimePlanDate();
//        String startTime1=sceneparam.getSceneTimePeriodParam().getHistoryTimePlanDate() +" " +sceneparam.getStartTimeStr();
//        String endTime1=sceneparam.getSceneTimePeriodParam().getHistoryTimePlanDate() +" " +sceneparam.getEndTimeStr();
//
//
//        //4、一个时间段内每秒刷卡进站人数
//        historyBizPersonLoaderService.loadNumPeopleEnStation(personDate, startTime1, endTime1);
//        numPeopEnStationApiInfoMap = historyBizPersonLoaderService.getNumPeopEnStationApiInfoMap();
//    }
//
//
//    public void loadODAssignPerson(String sceneCode) {
//        SceneParam sceneparam = UnitCache.sceneParamMap.get(sceneCode);
//        String odDate=sceneparam.getSceneTimePeriodParam().getHistoryODProbabilityDate();
//
//
//
//        String startTime=sceneparam.getStartTime().toString()+":00";
//
//
//        String ednTime=sceneparam.getEndTime().toString()+":00";
//        //1、各站人员OD分配概率
//        historyBizPersonLoaderService.getRouteStatistics(odDate,startTime,ednTime);
//        odProbabilityApiInfoMap = historyBizPersonLoaderService.getOdProbabilityApiInfoMap();
//    }
//
//
//    @Override
//    public void loadHistoryPerson(Map<String, Station> stationMap,
//                                  Map<String, TransferStation> transferStationMap,
//                                  String sceneCode) {
//        SceneParam sceneparam = UnitCache.sceneParamMap.get(sceneCode);
//
////        loadT80Route();//人员路径表
//        historyBizPersonLoaderService.setStationMap(stationMap);
//        historyBizPersonLoaderService.setTransferStationMap(transferStationMap);
//        historyBizPersonLoaderService.setT80RouteHisMap(t80RouteHisMap);
////        PsgStationDistributionInfo psgStationDistributionInfo = new PsgStationDistributionInfo();
//        loadEntryStationNum(sceneCode);
//        String dateTime = sceneparam.getSceneDate() + " " + sceneparam.getStartTime().toString()+":00";
//        historyBizPersonLoaderService.getPsgStationDistribution(dateTime);
//        //2、站内人员分布
//        psgStationDistributionInfoMap = historyBizPersonLoaderService.getStationPersonMap();
////        3、乘车人员分布
//        historyBizPersonLoaderService.getTrainPsgStationDistribution(dateTime);
//        personTrainMap = historyBizPersonLoaderService.getPersonTrainMap();
//        loadODAssignPerson(sceneCode);
//    }
//
//    @Override
//    public void loadHistroyTrain(Map<String, Station> stationMap, Map<String, TransferStation> transferStationMap, String sceneCode) {
//        SceneParam sceneparam = UnitCache.sceneParamMap.get(sceneCode);
//        historyBizTrainLoaderService.stationMap = stationMap;
//        VirtualTrainSchedularQueryCondition virtualTrainSchedularQueryCondition = new VirtualTrainSchedularQueryCondition();
//        //分时列车计划日期
//        virtualTrainSchedularQueryCondition.setDataDt(sceneparam.getSceneTimePeriodParam().getHistoryTimePlanDate());
//        virtualTrainSchedularQueryCondition.setStartTime( sceneparam.getSceneTimePeriodParam().getHistoryTimePlanDate()+" "+sceneparam.getStartTime().toString() +":00");
//        virtualTrainSchedularQueryCondition.setEndTime( sceneparam.getSceneTimePeriodParam().getHistoryTimePlanDate()+" "+sceneparam.getEndTime().toString() +":00");
//        historyBizTrainLoaderService.setVirtualTrainSchedularQueryCondition(virtualTrainSchedularQueryCondition);
//        historyBizTrainLoaderService.setIsAllDay(false);
//        historyBizTrainLoaderService.loadTimePlanData();
//        trainPlanTableMapByLine = historyBizTrainLoaderService.getTrainPlanTableByLineMap();
//
//    }
}
